<!--[if HTML5]><![endif]-->
<!DOCTYPE html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]><html class="ie ie6 ie-lte9 ie-lte8 ie-lte7 no-js" lang="{{=T.accepted_language or 'en'}}"> <![endif]-->
<!--[if IE 7]><html class="ie ie7 ie-lte9 ie-lte8 ie-lte7 no-js" lang="{{=T.accepted_language or 'en'}}"> <![endif]-->
<!--[if IE 8]><html class="ie ie8 ie-lte9 ie-lte8 no-js" lang="{{=T.accepted_language or 'en'}}"> <![endif]-->
<!--[if IE 9]><html class="ie9 ie-lte9 no-js" lang="{{=T.accepted_language or 'en'}}"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html class="no-js" lang="{{=T.accepted_language or 'en'}}"> <!--<![endif]-->
<head>
<title>{{=response.title or request.application}}</title>
  <!--[if !HTML5]>
      <meta http-equiv="X-UA-Compatible" content="IE=edge{{=not request.is_local and ',chrome=1' or ''}}">
  <![endif]-->
  <!-- www.phpied.com/conditional-comments-block-downloads/ -->
  <!-- Always force latest IE rendering engine
       (even in intranet) & Chrome Frame
       Remove this if you use the .htaccess -->
	   
  <meta charset="utf-8" />

  <!-- http://dev.w3.org/html5/markup/meta.name.html -->
  <meta name="application-name" content="{{=request.application}}" />

  <!-- Speaking of Google, don't forget to set your site up:
       http://google.com/webmasters -->
  <meta name="google-site-verification" content="" />

  <!--  Mobile Viewport Fix
        j.mp/mobileviewport & davidbcalhoun.com/2010/viewport-metatag
        device-width: Occupy full width of the screen in its current orientation
        initial-scale = 1.0 retains dimensions instead of zooming out if page height > device height
        user-scalable = yes allows the user to zoom in -->
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />

  <link rel="shortcut icon" href="{{=URL('static','images/favicon.ico')}}" type="image/x-icon">
  <link rel="apple-touch-icon" href="{{=URL('static','images/favicon.png')}}">

  <!-- All JavaScript at the bottom, except for Modernizr which enables
       HTML5 elements & feature detects -->
  <script src="{{=URL('static','js/modernizr.custom.js')}}"></script>  

  <!-- include stylesheets -->
  {{  
  response.files.append(URL('static','css/web2py.css'))
  response.files.append(URL('static','css/bootstrap.min.css'))
  response.files.append(URL('static','css/bootstrap-responsive.min.css'))
  response.files.append(URL('static','css/web2py_bootstrap.css'))
  response.files.append(URL('static','css/theme.css'))
  response.files.append(URL('static','ckeditor/ckeditor.js'))
  response.files.append(URL('static', 'select2/select2.css'))
  response.files.append(URL('static','select2/select2.min.js'))   
  
  }}

  {{include 'web2py_ajax.html'}}

  <!-- uncomment here to load jquery-ui
       <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css" type="text/css" media="all" />
       <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript"></script>
       uncomment to load jquery-ui //-->
  <noscript><link href="{{=URL('static', 'css/web2py_bootstrap_nojs.css')}}" rel="stylesheet" type="text/css" /></noscript>
  {{block head}}{{end}}
</head>

<body>
	<div class="navbar navbar-fixed-top">		
		<div class="flash">{{=response.flash or ''}}</div>
		<div class="navbar-inner">
				<div class="container">
					<a data-target=".navbar-inverse-collapse" data-toggle="collapse" class="btn btn-navbar">
						<i class="icon-reorder shaded"></i>
					</a>
				  	{{=A(IMG(_src=URL('static','images/Logo-Nero-Rosso-1201.png'), _class='brand', _height='100', _width='100', _border="0"), _href=URL('default', 'index'))}}
					{{if auth.is_logged_in():}}					
						<div class="nav-collapse collapse navbar-inverse-collapse">																		
							<ul class="nav nav-icons">
								<li><a href={{=URL('default', 'index')}}><i title={{=T("Home")}} class="icon-home shaded"></i></a></li>
								<li><a href={{=URL('default', 'search')}}><i title={{=T("Trova gladiatori")}} class="icon-search shaded"></i></a></li>
								<li><a href={{=URL('sfide', 'index')}}><i title={{=T("Sfide")}} class="icon-road shaded"></i></a></li>
								<li><a href={{=URL('statistiche', 'index')}}><i title={{=T("Statistiche")}} class="icon-eye-open shaded"></i></a></li>
								{{if auth.has_membership('Administrator'):}}
									<li><a href={{=URL('impostazioni', 'index')}}><i title={{=T("Impostazioni")}} class="icon-wrench shaded"></i></a></li>
								{{pass}}																																												
							</ul>
							<!--
							<form action="" class="navbar-search pull-left input-append">
								<input type="text" class="span3">
								<button type="button" class="btn"><i class="icon-search"></i></button>
							</form>			
							-->						
							<ul class="nav pull-right">			
								<li class="nav-user dropdown">
									<a data-toggle="dropdown" class="dropdown-toggle" href="#">																													
		                                <img class="nav-avatar" src="{{=URL('default', 'download', args=db.auth_user(auth.user_id).thumbnail)}}">
										<b class="caret"></b>
									</a>
									<ul class="dropdown-menu">
		                                <li><a href={{=URL(r=request, c='default', f='wall')}}>{{=T("Profilo")}}</a></li>																		
										<li class="divider"></li>
										<li><a href={{=URL(r=request, c='default', f='logout')}}>{{=T("Log out")}}</a></li>
									</ul>
								</li>
							</ul>																													
						</div><!-- /.nav-collapse -->
					{{pass}}					
				</div>
			</div>
	</div><!-- /navbar -->	
	<div class="wrapper">
		<div class="container">
			<div class="row">				
				{{if auth.is_logged_in():}}				
					<div class="span2">
						<div class="sidebar">
							<ul class="widget widget-menu unstyled">								 
								<li class="active">
									<a href={{=URL('messaggi', 'posta_in_arrivo')}}>
										<i class="menu-icon icon-inbox"></i>
										{{=T("Messaggi")}}
										<b class="label green pull-right">{{=getUnreadMessages()}}</b>
									</a>
								</li>															
								<li>
									<a href={{=URL('sfide', 'nuovo_test_personale')}}>
										<i class="menu-icon icon-plus"></i>
										{{=T("Test personale")}}
									</a>
								</li>
								<li>
									<a href={{=URL('sfide', 'lancio_sfida')}}>
										<i class="menu-icon icon-plus"></i>
										{{=T("Lancia sfida")}}
									</a>
								</li>									
								{{if hasSfideAperte():}}																
									<li>
										<a href={{=URL('sfide', 'sfide_aperte')}}>
											<i class="menu-icon icon-plus"></i>
											{{=T("Sfide aperte")}}
										</a>
									</li>		
								{{pass}}																												
								<li>
									<a href={{=URL('statistiche', 'index')}}>
										<i class="menu-icon icon-eye-open"></i>
										{{=T("Statistiche")}}
									</a>
								</li>
							</ul>						
						</div>
					</div>
					<div class="span8">
						<div class="content">					
							{{block center}}
								<div class="row-fluid">
									{{include}}
								</div>
							{{end}}												
						</div><!--/.content-->
					</div><!--/.span9-->
					<div class="span2">
						<div class="sidebar">
							<div class="module">
								<div class="module-body">
									CIAO
								</div>											
							</div>
						</div>
					</div>
				{{else:}}
					<div class="span12">
						<div class="row-fluid">
							{{include}}
						</div>
					</div>
				{{pass}}
			</div>
		</div><!--/.container-->
	</div><!--/.wrapper-->

	<div class="footer">
		<div class="container">									
			<b class="copyright">Copyright &copy; 2013 - Andrea Biasci</b>
		</div>
	</div>

	<!-- SCRIPTS: FLOT GRAPH ADVANCE -->
	<script type="text/javascript">
	$(function () {
		var d1 = [ [0, 1], [1, 14], [2, 5], [3, 4], [4, 5], [5, 1], [6, 14], [7, 5],  [8, 5] ];
		var d2 = [ [0, 5], [1, 2], [2, 10], [3, 1], [4, 9],  [5, 5], [6, 2], [7, 10], [8, 8] ];

		var plot = $.plot($("#placeholder2"),
			   [ { data: d1, label: "Data Y"}, { data: d2, label: "Data X" } ], {
					lines: {
						show: true,
						fill: true, /*SWITCHED*/
						lineWidth: 2
					},
					points: {
						show: true,
						lineWidth: 5
					},
					grid: {
						clickable: true,
						hoverable: true,
						autoHighlight: true,
						mouseActiveRadius: 10,
						aboveData: true,
						backgroundColor: "#fafafa",
						borderWidth: 0,
						minBorderMargin: 25,
					},
					colors: [ "#090", "#099",  "#609", "#900"],
					shadowSize: 0
				 });

		function showTooltip(x, y, contents) {
			$('<div id="gridtip">' + contents + '</div>').css( {
				position: 'absolute',
				display: 'none',
				top: y + 5,
				left: x + 5
			}).appendTo("body").fadeIn(300);
		}

		var previousPoint = null;
		$("#placeholder2").bind("plothover", function (event, pos, item) {
			$("#x").text(pos.x.toFixed(2));
			$("#y").text(pos.y.toFixed(2));

			if (item) {
				if (previousPoint != item.dataIndex) {
					previousPoint = item.dataIndex;

					$("#gridtip").remove();
					var x = item.datapoint[0].toFixed(0),
						y = item.datapoint[1].toFixed(0);

					showTooltip(item.pageX, item.pageY,
								"x : " + x + "&nbsp;&nbsp;&nbsp; y : " + y);
				}
			}
			else {
				$("#gridtip").remove();
				previousPoint = null;
			}
		});
	});
	</script>
  	<script src="{{=URL('static','js/bootstrap.min.js')}}"></script>
  	<script src="{{=URL('static','js/web2py_bootstrap.js')}}"></script>
  	<script src="{{=URL('static','js/share.js',vars=dict(static=URL('static','images')))}}"></script>  	
	{{if response.google_analytics_id:}}
		<script src="{{=URL('static','js/analytics.min.js')}}"></script>
	  	<script type="text/javascript">
	  		analytics.initialize({
	    		'Google Analytics':{trackingId:'{{=response.google_analytics_id}}'} 
	  		});
	  	</script>
	{{pass}}  	  	
</body>
</html>
